<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>需求定位</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../../../taofang/plugins/bootstrap-3.3.7-dist/css/bootstrap.css">
    <link rel="stylesheet" href="../../../taofang/css/TenantCentre.css">
    <link rel="stylesheet" href="../../../taofang/css/home.css">
</head>
<body>
<script src="../../../taofang/plugins/jquery-3.4.1.js"></script>
<script src="../../../taofang/plugins/bootstrap-3.3.7-dist/js/bootstrap.js"></script>

<%@include file="top.jsp"%>

<div class="col-md-9 zy5">
    <p class="zy51">需求定位</p>
    <p class="zy52"></p>
    <div class="zf1" style="font-size: 30px;color: black;opacity: 0.5">
        需求定位及修改,勾选完毕后请点击<span style="color: blue;font-weight:bolder">"确定"</span>保存<br>
    </div>
    <br>

    <div class="zf1">
        户型:
        <label class="radio-inline">
            <input type="radio" name="houseType" id="houseType1" value="option1" <c:if test="${intention.houseType=='小户型'}">checked</c:if> > 小户型
        </label>
        <label class="radio-inline">
            <input type="radio" name="houseType" id="houseType2"  value="option2" <c:if test="${intention.houseType=='中户型'}">checked</c:if>> 中户型
        </label>
        <label class="radio-inline">
            <input type="radio" name="houseType" id="houseType3"  value="option2" <c:if test="${intention.houseType=='大户型'}">checked</c:if>> 大户型
        </label>
    </div>
    <br>
    <hr>

    <div class="zf1">
        楼层:
        <label class="radio-inline">
            <input type="text" style="width: 50px;text-align: center;color: blue;font-weight: bolder" id="floor" value="${intention.floor}">层
        </label>
    </div>
    <br>
    <hr>

    <div class="zf1">
        朝向:
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or1" value="option1" <c:if test="${intention.orientate=='东'}">checked</c:if> > 东
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or2"  value="option2" <c:if test="${intention.orientate=='南'}">checked</c:if> > 南
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or3"  value="option3" <c:if test="${intention.orientate=='西'}">checked</c:if>> 西
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or4"  value="option4" <c:if test="${intention.orientate=='北'}">checked</c:if>> 北
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or5" value="option5" <c:if test="${intention.orientate=='东南'}">checked</c:if>> 东南
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or6"  value="option6" <c:if test="${intention.orientate=='东北'}">checked</c:if>> 东北
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or7"  value="option7" <c:if test="${intention.orientate=='西南'}">checked</c:if>> 西南
        </label>
        <label class="radio-inline">
            <input type="radio" name="orientate" id="or8"  value="option8" <c:if test="${intention.orientate=='西北'}">checked</c:if>> 西北
        </label>
    </div>
    <br>
    <hr>

    <div class="zf1">
        停车位:
        <label class="radio-inline">
            <input type="radio" name="optionsRadiosinline2" id="p1" value="option1" <c:if test="${intention.parkPlace=='true'}">checked</c:if> > 有
        </label>
        <label class="radio-inline">
            <input type="radio" name="optionsRadiosinline2" id="p2"  value="option2" <c:if test="${intention.parkPlace=='false'}">checked</c:if> > 无
        </label>
    </div>
    <br>
    <hr>

    <hr>
    <div style="margin-top: 5%;margin-left: 30%">
        <button type="button" onclick="changedemand()" class="btn btn-info">确定</button>&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-info" onclick="demandFind()">根据需求查看房源</button>
    </div>

</div>

<%@include file="bottom.jsp"%>


<script>
    function changedemand() {
        let a1 = document.getElementById("houseType1").checked;
        let a2 = document.getElementById("houseType2").checked;
        let a3 = document.getElementById("houseType3").checked;
        let a = "";
        if(a1){
            a="小户型";
        }else if(a2){
            a="中户型";
        }else if(a3){
            a="大户型";
        }
        let floor = $("#floor").val();
        if (floor==""){
            floor=1;
        }

        let b1 = document.getElementById("or1").checked;
        let b2 = document.getElementById("or2").checked;
        let b3 = document.getElementById("or3").checked;
        let b4 = document.getElementById("or4").checked;
        let b5 = document.getElementById("or5").checked;
        let b6 = document.getElementById("or6").checked;
        let b7 = document.getElementById("or7").checked;
        let b8 = document.getElementById("or8").checked;
        let b ="";
        if(b1){
            b="东";
        }else if(b2){
            b="南";
        }else if(b3){
            b="西";
        }else if(b4){
            b="北";
        }else if(b5){
            b="东南";
        }else if(b6){
            b="东北";
        }else if(b7){
            b="西南";
        }else if(b8){
            b="西北";
        }

        let c1 = document.getElementById("p1").checked;
        let c2 = document.getElementById("p2").checked;
        let c="";

        if (c1){
            c="true";
        }else if (c2){
            c="false";
        }

        let tenantId =$("#tenantId").val();

        if (confirm("是否保存")){


        alert("保存成功")

        window.location="/taofang/intention/updateDemand.action?houseType="+a+"&floor="+floor+"&orientate="+b+"&parkPlace="+c+"&tenantId="+tenantId;

        }else{
            window.location="/taofang/intention/TenantDemand.action?tenantId="+tenantId;
        }
    }



    function demandFind() {

        let a1 = document.getElementById("houseType1").checked;
        let a2 = document.getElementById("houseType2").checked;
        let a3 = document.getElementById("houseType3").checked;
        let a = "";
        if(a1){
            a="小户型";
        }else if(a2){
            a="中户型";
        }else if(a3){
            a="大户型";
        }

        let b1 = document.getElementById("or1").checked;
        let b2 = document.getElementById("or2").checked;
        let b3 = document.getElementById("or3").checked;
        let b4 = document.getElementById("or4").checked;
        let b5 = document.getElementById("or5").checked;
        let b6 = document.getElementById("or6").checked;
        let b7 = document.getElementById("or7").checked;
        let b8 = document.getElementById("or8").checked;
        let b ="";
        if(b1){
            b="东";
        }else if(b2){
            b="南";
        }else if(b3){
            b="西";
        }else if(b4){
            b="北";
        }else if(b5){
            b="东南";
        }else if(b6){
            b="东北";
        }else if(b7){
            b="西南";
        }else if(b8){
            b="西北";
        }

        let c1 = document.getElementById("p1").checked;
        let c2 = document.getElementById("p2").checked;
        let c="";

        if (c1){
            c="true";
        }else if (c2){
            c="false";
        }
        window.location="/taofang/House/ZhengType.action?houseType="+a+"&orientate="+b+"&parkPlace="+c;





    }
</script>

</body>
</html>
